#!/bin/bash
# auther: leman Lai
#date: 2020.2.25

##1.添加用户
useradd php -s /bin/nologin
##2. 安装依赖包
yum -y install libxml2-devel libxml2 libxml2-devel curl curl-devel  libjpeg-devel libpng-devel freetype-devel libxslt-devel
##3。 下载包
mkir -p /server/source/

wget  http://cn2.php.net/distributions/php-7.0.6.tar.gz
tar -xf php-7.0.6.tar.gz
cd php-7.0.6

##4. 编译
./configure \
--prefix=/usr/local/php \
--with-config-file-path=/etc \
--enable-inline-optimization \
--disable-debug \
--disable-rpath \
--enable-shared \
--enable-opcache \
--enable-fpm \
--with-fpm-user=php\
--with-fpm-group=php \
--with-mysql=mysqlnd \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
--with-gettext \
--enable-mbstring \
--with-iconv \
--with-mhash \
--with-openssl \
--enable-bcmath \
--enable-soap \
--with-libxml-dir \
--enable-pcntl \
--enable-shmop \
--enable-sysvmsg \
--enable-sysvsem \
--enable-sysvshm \
--enable-sockets \
--with-curl \
--with-zlib \
--enable-zip \
--with-bz2 \
--without-sqlite3 \
--without-pdo-sqlite \
--with-pear

##5. 安装
make && make install

cd /usr/local/php/etc
cp php-fpm.conf.default php-fpm.conf

cd /server/source/php-7.0.6
cp php.ini-development /usr/local/php/etc/php.ini

cd /usr/local/php/etc/php-fpm.d/
cp www.conf.default www.conf

#启动
/usr/local/php/sbin/php-fpm
echo "/usr/php/sbin/php-fpm" >/etc/rc.local

##检查
netstats -tunlp|grep php
